package li.kaeppe.travel.tracker.web.backing;

import li.kaeppe.travel.tracker.domain.BlogEntry;
import li.kaeppe.travel.tracker.service.BlogEntryService;
import li.kaeppe.travel.tracker.service.TripService;
import li.kaeppe.travel.tracker.web.bean.BlogEntryBean;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/* ******************************************************************* *
 * Travel Tracker
 *
 * Author: Daniel Kaeppeli
 * Copyright by Daniel Kaeppeli
 * 
 * Last changed by:   $Author$
 * Last changed date: $LastChangedDate$
 * Revision number:   $Rev$
 * ******************************************************************* */

public class BlogEntryBacking {
	/* **************************************************** */
	/*                      CONSTANTS                       */
	/* **************************************************** */
	
	private static final Log log = LogFactory.getLog(BlogEntryBacking.class);
	
	/* **************************************************** */
	/*                     MEMBER FIELDS                    */
	/* **************************************************** */
	
	private BlogEntryService blogEntryService;
	
	private TripService travelTrackerService;
	
	private BlogEntryBean blogBean;
	
	/* **************************************************** */
	/*                      CONSTRUCTOR                     */
	/* **************************************************** */
	
	/* **************************************************** */
	/*                    PUBLIC METHODS                    */
	/* **************************************************** */

	public String saveEntry() {
		if(log.isDebugEnabled()) {
			log.debug("BlogEntryService -> saveEntry()");
		}
		
		BlogEntry entry = new BlogEntry();
//		entry.setContent(this.getBlogBean().getContent());
//		entry.setTitle(this.getBlogBean().getTitle());
//		entry.setWayPoint(this.getTravelTrackerService().getWayPointById(this.getBlogBean().getWayPointId()));
		
		this.getBlogEntryService().storeBlogEntry(entry);
		return "success";
	}
	
	/* **************************************************** */
	/*                  PROTECTED METHODS                   */
	/* **************************************************** */
	
	/* **************************************************** */
	/*                   PRIVATE METHODS                    */
	/* **************************************************** */
	
	/* **************************************************** */
	/*                  GETTERS AND SETTERS                 */
	/* **************************************************** */
	
	public BlogEntryService getBlogEntryService() {
		return blogEntryService;
	}

	public void setBlogEntryService(BlogEntryService blogEntryService) {
		this.blogEntryService = blogEntryService;
	}

	public BlogEntryBean getBlogBean() {
		return blogBean;
	}

	public void setBlogBean(BlogEntryBean blogBean) {
		this.blogBean = blogBean;
	}

	public TripService getTravelTrackerService() {
		return travelTrackerService;
	}

	public void setTravelTrackerService(TripService travelTrackerService) {
		this.travelTrackerService = travelTrackerService;
	}
}
